package com.qiangqiang.resoldhouse.service;

import com.qiangqiang.resoldhouse.dto.AreaDTO;
import com.qiangqiang.resoldhouse.entity.Area;
import com.qiangqiang.resoldhouse.util.TimeFormat;
import org.springframework.beans.BeanUtils;

/**
 * @author : sky
 * @date : 2018/7/17
 * @description :
 */
public class BaseService {

    /**
      * @author sky
      * @date 2018/7/24
      * @param [area]
      * @return com.qiangqiang.resoldhouse.dto.AreaDTO
      * @describe: 减少代码冗余
     */
    public AreaDTO beanToDTO(Area area){
        AreaDTO areaDTO = new AreaDTO();
        BeanUtils.copyProperties(area, areaDTO);
        areaDTO.setUpdateTime(TimeFormat.converTime(area.getUpdateTime()));
        areaDTO.setCreateTime(TimeFormat.converTime(area.getCreateTime()));
        return areaDTO;
    }
}
